ClojureScript

Reassess ObjectMap vs. PersistentArrayMap

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Here are some benchmarks after performance improvements have been applied to PersistentArrayMap in master:

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

Again we see nearly identical (or much better) performance at small sizes and much better performance for PAMs as we approach the PHM threshold.

Activity

David Nolen made changes -
Field Original Value New Value
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases. On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjectMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjectMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjectMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjectMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjectMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjectMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv
On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
David Nolen made changes -
Description On V8, PAMs are competitive with OMs. On other browsers the performance doesn't look as good but this is probably due to the higher order code in array-map-index-of. We should remove the higher order code and more closely follow the Java PAM implementation which has different lookup loops for the different cases.

Here are some benchmarks -

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
Here are some benchmarks after performance improvements have applied to PersistentArrayMap in master:

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
David Nolen made changes -
Description Here are some benchmarks after performance improvements have applied to PersistentArrayMap in master:

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
Here are some benchmarks after performance improvements have applied to PersistentArrayMap in master:

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical (or much better) performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
David Nolen made changes -
Priority Minor [ 4 ] Major [ 3 ]
David Nolen made changes -
Description Here are some benchmarks after performance improvements have applied to PersistentArrayMap in master:

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical (or much better) performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
Here are some benchmarks after performance improvements have been applied to PersistentArrayMap in master:

* ObjMap vs PersistentArrayMap 1 entry -lookup, http://jsperf.com/ojbmap-vs-persistentarraymap-lookup-1
* ObjMap vs PersistentArrayMap 3 entry -lookup, http://jsperf.com/objectmap-vs-persistentarraymap-3-lookup
* ObjMap vs PersistentArrayMap 7 entry -lookup, http://jsperf.com/objmap-vs-persistentarraymap-7-lookup

For the smallest sizes PAMs are nearly identical in performance to OMs, as we start nearing the PHM threshold PAMs are nearly 2X faster on WebKit Nightly, and nearly 3X faster on the latest Chrome. Only Firefox Nightly lags behind for lookup times at larger sizes.

* ObjMap vs PersistentArrayMap assoc empty, http://jsperf.com/objmap-vs-persistentarraymap-assoc-empty
* ObjMap vs PersistentArrayMap assoc 3kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-3
* ObjMap vs PersistentArrayMap assoc 7kv, http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

Again we see nearly identical (or much better) performance at small sizes and much better performance for PAMs as we approach the PHM threshold.
Hide
Tyler Tallman added a comment -

When I try to run the jsprefs I get "ReferenceError: cljs_perf is not defined."

Show
Tyler Tallman added a comment - When I try to run the jsprefs I get "ReferenceError: cljs_perf is not defined."
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: