Giter Site home page Giter Site logo

mapfiltertest's Introduction

MapFilterTest

Simple java test project to investigate* a performance question that came up with Myself and some colleagues.

Description

To measure this, I created a simple test that creates a Map of fixed size, after this a series of 'tests' are created and stored in TEST_FILTERS. By doing this, the aim was to set up a random data set that could be shared among the 3 different 'algorithms' and therefore create some common conditions to measure the performance of each.

There were 2 different ways identified that the problem could be solved.

  1. Through using retainAll on the key set (First, creating a temporary copy so as not to modify the original map).
  2. Through using stream().filter() on the original map.

Results

  • The test was carried out on my local machine (2015 MacBook Pro - 8GB RAM).
  • I used a DATA_SIZE size of 10,000.
  • In my test run, TEST_FILTERS contained 2634 randomly generated elements.

The results observed by myself are as below, I found the use of .stream().filter(...) to be roughly twice as fast, when taking an average of all 2364 iterations across the 3 runs.

* Motivation for this test was purely to prove someone wrong. For anonymity the backers of each solution will not be named.

mapfiltertest's People

Contributors

mtjb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.