Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Huge speedup #2765

@arthurwolf

Description

@arthurwolf

I've been profiling zenbot (in simulation mode)
It was spending most of it's time in lolex doing Object key lookups.
I solved that by storing lolex timers in a queue instead of an Object, giving an over 10x speed increase.

However, after further review, it was still taking most of it's time handling "fake" setTimeouts to call checkorder again and again.
I replaced that mechanism with a .done() .fail() mechanism instead (required a small change to the sim exchange, instead of polling for an order to be done, the exchange calls the callback once the order is done), and now simulations that at the beginning of the day took over 30 seconds, now run in well under a second (they are seemingly instant).

I think there's some more I can do to improve still, but for the moment this is enough for my needs (ie make it fast enough for genetic optimization to be pratical/not take days).

The source is available to anyone who wants the speed upgrade, but isn't good enough for a PR yet (that's the plan though): I don't think the current code would work outside of simulations (ie trade/paper).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions