Skip to content

Performance issue on Node 4x #54

@aheckmann

Description

@aheckmann

On NodeJS 4x, when configuring lru-cache with a max setting above 8192, behavior gradually becomes very slow. The longer it runs, the slower it gets.

Starting with a max of 8193, the program abruptly slows down soon after the maximum number of elements have been reached. Soon it will take upwards of 30 seconds to process 5000 set/removes. As the max setting is raised higher and higher, performance still slows down but the program needs to run longer and longer to reach the same level of performance degradation.

I haven't been able to reproduce this behavior on any of these earlier releases of Node/iojs:

  • iojs-3.3.1
  • iojs-2.5.0
  • iojs-1.8.4
  • node-0.12.7
  • node-0.11.16
  • node-0.10.40

This is probably a V8 bug but worth making this known here.

Note: I forked this module and changed it to use Map instead of Object.create(null) and the issue is resolved. Not sure if switching to a Map is the right choice for this module due to backward compatibility (and browser support) but it looks like it could be a good solution going forward. I haven't pushed my code public yet but let me know if you'd be interested in going that direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions