Search found 89 matches

by cag
Tue Jul 11, 2017 12:16 am
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

We should make a list (a reference, not a tutorial) of faster alternatives: ship.checkScanner() is "usually considerably quicker than system.filteredEntities()" according to the wiki There are also system.entitiesWithScanClass, system.shipsWithRole and system.shipsWithPrimaryRole which are much fast...
by cag
Fri Jul 07, 2017 10:24 pm
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

Cool! And certainly 'not obvious' (to me, at least). Remember most of us are self-taught wrt JScript - at first I thought that was another keyword, like self in Python :) So you're basically storing a (far) reference as a function's property. Would it be safe to say, for clarity, that var floor = (t...
by cag
Sun Jul 02, 2017 9:46 pm
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

- the following is faster than indexOf when dealing with arrays: this._index_in_list = function( item, list ) { // for arrays only var k = list.length; while( k-- ) { if( list[ k ] === item ) return k; } return -1; } I've decided to add if( !list ) return -1; as the 1st line, so that calling it is ...
by cag
Fri Jun 30, 2017 8:39 pm
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

In the other scripts: And the subscribers will put their startUp code in: this._startUp = function() { // move your startUp code here }; Submit to you, compel everyone, how will you, 'Master', hmm? :) Granted, your solution is easier to grasp than http://wiki.alioth.net/index.php/Handling_OXP_Depen...
by cag
Thu Jun 29, 2017 7:59 pm
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

First, some micro-optimizations: To test your assertion, I profiled the following: (function (){ function truth() { var x = true; return x ? true : false; } function plain() { var x = true; return x; } log(console.profile( function() {var i=10000; var result = false; while(i--) { result = result &&...
by cag
Sat Jun 24, 2017 5:25 am
Forum: Expansion Pack
Topic: [RELEASE] Telescope OXP v1.15
Replies: 105
Views: 65038

Re: [RELEASE] Telescope OXP v1.14

Quick, before anyone notices, I've got an update:
https://www.dropbox.com/s/jaro5d1msro27 ... g.zip?dl=0
I fixed a couple of silly (but ugly) mistakes and added a couple of tweaks.
by cag
Sat Jun 24, 2017 1:52 am
Forum: Expansion Pack
Topic: [RELEASE] HUD Requests OXP and LogEvents OXP
Replies: 35
Views: 21622

Re: [RELEASE] HUD Requests OXP and LogEvents OXP

LogEvents is throwing an error: cyclic object value (don't ask me, I've never seen it before!) This occurs when cycling the compass in a heavily populated system, eg. 4 orbs (planet,moon or sun), 4 stations, 3 buoys Exception: TypeError: cyclic object value Active script: logevents 1.1 logevents.js,...
by cag
Fri Jun 23, 2017 9:46 pm
Forum: Expansion Pack
Topic: OXP Development Best Practices
Replies: 55
Views: 62805

Re: OXP Development Best Practices

If you plan on profiling your code, I recommend adding the repeat name on all your functions. Otherwise you get: NAME T COUNT TOTAL SELF TOTAL% SELF% SELFMAX WorldScriptsGetProperty N 779 43.52 39.73 42.9 39.1 0.25 OOStringFromJSString N 1536 7.63 7.63 7.5 7.5 0.19 ShipGetProperty N 3778 13.91 7.07 ...
by cag
Thu Jun 22, 2017 6:17 pm
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

I think it's because we're bypassing JS type checking, prototype & boundary tests. For example, if list is null, we'll get a reference error. But I'd rather know that case exists sooner rather than later.
by cag
Thu Jun 22, 2017 3:03 am
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

Yes, you do need that this! shipsToDamage = system.filteredEntities(this, this.$toDamage); The 1st (lone) this tells filteredEntities where to operate in, in what 'scope' or enviroment to use (ie. this tells it to run using your script file's variables). You absolutely need the 2nd one on $toDamage,...
by cag
Thu Jun 22, 2017 2:28 am
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

the following is faster than indexOf when dealing with arrays: this._index_in_list = function( item, list ) { // for arrays only var k = list.length; while( k-- ) { if( list[ k ] === item ) return k; } return -1; } so, if( targets.indexOf( ship ) ... becomes if( ws._index_in_list( ship, targets ) .....
by cag
Thu Jun 22, 2017 2:10 am
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

your error is coming from

Code: Select all

s = system.allShips;
...
shipsToDamage = s.filteredEntities(this, $toDamage);
allShips is just an array i.e., a property of system, and has no methods.
filteredEntities is a method of system.
So, instead, just use

Code: Select all

shipsToDamage = system.filteredEntities(this, $toDamage);
by cag
Tue Jun 20, 2017 4:01 am
Forum: Expansion Pack
Topic: [RELEASE] Telescope OXP v1.15
Replies: 105
Views: 65038

Re: [RELEASE] Telescope OXP v1.11

Ok, here you go.
https://www.dropbox.com/s/sung0mwceqhus ... g.zip?dl=0
I can't say for sure I didn't introduce any bugs but there's only one way to find out . . .
by cag
Thu Jun 15, 2017 5:14 am
Forum: Expansion Pack
Topic: [RELEASE] Telescope OXP v1.15
Replies: 105
Views: 65038

Re: [RELEASE] Telescope OXP v1.11

Having profiled some of my code, I discoverd unexpected culprits wasting time & killing my frame rate: - WorldScriptsGetProperty - ShipGetProperty - EntityGetProperty These 3 were consistently appearing near the top of the profile's listing, WorldScriptsGetProperty by far the worst, accounting from ...
by cag
Thu Jun 15, 2017 4:49 am
Forum: Expansion Pack
Topic: OXP Performance tips
Replies: 82
Views: 59958

Re: OXP Performance tips

Good idea for a topic but it will need to a) be made sticky and b) moderated (ie. edit/modify/delete posts). This has been tried before but after a few pages of off topic discussion, I usually give up on it. You've got some good ideas but we need across the board adoption to really impact frame rate...