Commit Graph

9 Commits

Author SHA1 Message Date
carnie
05b76b123e TimSort for byond:
RESULTS:
sorting 10 random lists of length 3 to 303 in increments of 3
(Meh, I forgot to refresh this one, there were only 338 trials rather than 1010, can't be bothered to recode the test)
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           0.672       16.141       16.243       171226  <--TG's current mergesort(recursive, hence the higher number of calls)
/proc/sortTim                                            0.008        3.278        3.274          338  <--TimSort
/proc/sortMerge                                          0.011        2.839        2.855          338  <--new mergesort
/proc/sortInsert                                         0.010        2.124        2.103          338  <--binary insertion

Sorting 10 presorted lists with 3 inversions (3 elements shuffled up), Lists of length 3 to 303 (increments of 3)
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.290       23.056       23.254       308050	<--rather cataclysmic
/proc/sortMerge                                          0.015        4.077        4.068         1010	<--
/proc/sortInsert                                         2.639        3.472        3.464         1010	<--
/proc/sortTim                                            0.014        1.567        1.576         1010	<--TimSort is faaar more effective in these cases,
Timsort can exploit runs effectively

sorting 10 presorted lists which have been reversed
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.234       23.193       23.295       308050
/proc/sortMerge                                          0.023        4.681        4.686         1010
/proc/sortInsert                                         2.875        3.750        3.765         1010
/proc/sortTim                                            0.020        3.294        3.284         1010	//This can be lower by using a different comparison method
 *Corrected: /proc/sortTim                                0.017        0.665        0.663         1010	//Using a non-strictly ascending comparison

sorting 10 presorted lists
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.199       21.391       21.517       308050
/proc/sortMerge                                          0.018        3.724        3.729         1010
/proc/sortInsert                                         2.497        3.302        3.309         1010
/proc/sortTim                                            0.024        0.586        0.584         1010

Summary, all the new procs are faster than the old ones. TimSort is ever so slightly slower than Insertion and Merging on random lists. But on lists with natural runs (partially sorted data) it is far faster than all others.

The old merge sort was removed and replaced with timSort. Other algorithms are provided as alternatives.

All algorithms use a central datum, so accept many of the same parameters. For instance, setting associative=1 will make them sort associative lists by their associated values, rather than keys.
They also accept a cmp argument. This allows sorting of lists of datums, text, numbers or whatever. The pre-existing helpers in lists.dm were rewritten as examples.
2014-09-01 11:29:49 +01:00
Firecage
6c7af5eb32 SPANCLASSES!!!!! 2014-08-26 09:52:13 +02:00
MrPerson
2991dd72c9 More qdel() changes.
Move all atom/Destroy() behavior to atom/movable/Destroy() so turf/areas that get qdel()'d just get del()'d like they're supposed to. Also do tag = null, which should make more things GC.
Make cameras GC correctly and some misc grammar fixes.
Make smoke grenades GC.
Tell camera bugs to del() because I'm not working on complex behavior for one item.
2014-03-31 01:11:37 -07:00
Giacomand
3e3e193c79 Camera bug sprites from Rob 2013-11-23 17:10:43 +00:00
supersayu
5a385a1159 Final? values for camerabug expansion item types
There wasn't much feedback, so I just threw together something acceptable, not being able to think of anything particularly clever.
- Universal bug: atmos analyzer or subspace analyzer
- Sabotage bug: Igniter, infrared tripwire thing, or subspace amplifier
- Network bug: Radio, signaler, or subspace transmitter
- Advanced bug: Detective scanner, pAI card, or scanning module stock part
2013-06-06 20:14:06 -04:00
supersayu
0f8b28bf53 Combines the prototypes back into one finished camera bug.
Adds an associative list sorter to the helper procs.  This will sort a list while maintaining the key=value structure.
The tracking functions of the camera bug will now auto-refresh if you keep the window open.  The functionality was there but broken previously.  This allows you to creepily stalk someone or observe a sensitive area.

The camera bug is now extensible.  If you add an extension of certain types, the bug will have additional functionality.  A screwdriver will remove the existing extension.  Additionally, an admin/testing version of the camera bug can be created with the research admin spawnable item.

This is not the final version of this code; sane item types for the extensions must be chosen.  I do not have any that are feasible right now.
2013-06-02 00:54:04 -04:00
supersayu
1945a7cc22 Splits the camera bug into several different prototypes:
* Vanilla - Sees its own bugs only
* Universal - Sees all bugs
* Networked - Sees all cameras
* Sabotage - Sacrifices a bug to EMP a camera
* Tracker - Lets you monitor who is near a camera and what camera a person is near.  Some limitations.
2013-05-16 22:28:14 -04:00
supersayu
e8090ae34c Fixes 'Camera Bug' item and makes it a viable tool.
Camera bug acts as a mini-camera computer with access to all bugged cameras.

Adjusts camera checks to determine who is looking through them; instead of checking their machine, it now checks the client eye.

Adds camera bug to the uplink list with a cost of 2TC.
2013-05-12 17:52:40 -04:00
supersayu
272f667c1c Fixes 'Camera Bug' item and makes it a viable tool.
Camera bug acts as a mini-camera computer with access to all bugged cameras.

Adjusts camera checks to determine who is looking through them; instead of checking their machine, it now checks the client eye.

Adds camera bug to the uplink list with a cost of 2TC.
2013-05-12 17:49:02 -04:00