Immutable.js: Set of ids from List

Benchmark created on


Preparation HTML

<script src="https://cdn.jsdelivr.net/npm/immutable@5.0.3/dist/immutable.min.js"></script>

Setup

var list = Immutable.fromJS(
	Array(1000).fill(null).map((_, index) => ({
		id: crypto.randomUUID(),
		name: 'Item ' + (index + 1),
	}))
);

Test runner

Ready to run.

Testing in
TestOps/sec
Map → toSet
var ids = list.map((item) => item.get('id')).toSet();
ready
valueSeq → Map → toSet
var ids = list.valueSeq().map((item) => item.get('id')).toSet();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.