Git Product home page Git Product logo

hppc's Introduction

HPPC: High Performance Primitive Collections

Collections of primitive types (maps, sets, stacks, lists) with open internals and an API twist (no java.util.collections.* compatibility).

See the following for more information:

See ALTERNATIVES.txt if you're just shopping around.

See LICENSE.txt to make your company's lawyer happy.

See CHANGES.txt for API changes and updates.

(c) Carrot Search s.c. (and contributors), https://carrotsearch.com/

hppc's People

Contributors

bruno-roustant avatar don-vip avatar dweiss avatar gdelafosse avatar mdekstrand avatar software-is-art avatar svistoplyaz avatar upwards-gravity avatar zhaih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hppc's Issues

Predicate-based forEach() [HPPC-9]

Next to the forEach method we have now, we could have a version with [type]Predicate as an argument. The predicate-based version would be similar to jQuery.each: if the predicate returns true, the iteration will be finished (equivalent of break), for false, the iteration will continue (equivalent of continue).


Issue: HPPC-9 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 10 2010

Primitive Maps: clear() not working [HPPC-45]

The following code:
IntIntOpenHashMap map = new IntIntOpenHashMap();
map.put(1, 69);
System.out.println("Size "+map.size());
System.out.println("Get: "+map.get(1));
map.clear();
System.out.println("New Size "+map.size());
System.out.println("New Get: "+map.get(1));

Prints:
Size 1
Get: 69
New Size 0
New Get: 69

The same thing happens with other primitive maps (LongLong, etc). Maps with objects (e.g. LongObject) seem to be working fine, though.


Issue: HPPC-45 (migrated from JIRA), created by Pedro, resolved Feb 03 2011

Add integration with Google Collections/Guava [HPPC-4]

I think it makes sense to have an integration layer with Google Collections/Guava as part of HPPC. I'm specifically thinking of some sort of adapters to their Function and Predicate utilities.


Issue: HPPC-4 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Apr 11 2011

Add toString() methods [HPPC-1]

The toString() method is extremely useful when debugging in an IDE. Deciphering the contents of a BitSet based on the 64-bit mask is for the really hard-core assembly programmers ;-)


Issue: HPPC-1 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 10 2010

Investigate and compare against JDK7 sorting algorithms. [HPPC-33]

JDK7 introduces new sorting algorithms: dual pivot quicksort and "tim's merge sort". Evaluate on synthetic data and see what the difference is.

http://gdtoolbox.com/DualPivotQuicksort.pdf

I created a benchmark against sun-jdk1.7.0_ea_b104. The benchmark tried to compare "new" vs. "old" implementation of Collections.sort() first; on nearly-sorted strings, representing integers from 0..1000000:

        benchmark    ms linear runtime
       LegacySort  39.5 ===
          NewSort  25.3 ==

this turns out really well compared to IndirectSort:

        benchmark    ms linear runtime
IndirectMergeSort  63.7 ======
IndirectQuickSort 313.3 ==============================
       LegacySort  39.5 ===
          NewSort  25.3 ==

but there is a catch: that was nearly sorted data. The same benchmark, but executed on 1.6_20 shows hotspot improvements have been made as well, not only algorithmic improvements (I assume LegacySort didn't change between 1.6 and 1.7; haven't verified this):

        benchmark    ms linear runtime
IndirectMergeSort  63.5 =====
IndirectQuickSort 317.8 ==============================
       LegacySort  53.3 =====
          NewSort  53.2 =====

Very similar results from jrockit:

        benchmark    ms linear runtime
IndirectMergeSort  69.6 =====
IndirectQuickSort 396.9 ==============================
       LegacySort  60.5 ====
          NewSort  60.2 ====

vm: c:\java\jrmc-4.0.0-1.6.0\bin\java.exe

The second benchmark changed the scenario: I randomized the input so it wasn't nearly sorted and I changed Collections.sort() to Arrays.sort() calls to run on Integer[] arrays with a custom comparator, simulating IndirectSort's functionality. This yields, from 1.7:

        benchmark   ms linear runtime
IndirectMergeSort  785 ====================
IndirectQuickSort  918 =======================
       LegacySort 1156 =============================
          NewSort 1163 ==============================

Ok, much more sensible.

Conclusions: if data is nearly sorted and can be reordered, stick to Collections.sort(). If data is randomized and you don't want to reorder the input (for whatever reason), use IndirectSort.


Issue: HPPC-33 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Mar 14 2011

Build fails with ANT 1.8. [HPPC-15]

Apparently there is a stronger check for inheritance hierarchy between filtermapper/filterchains.


Issue: HPPC-15 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Feb 19 2010

toArray() on object types must return actual T[], not Object[] [HPPC-46]

There is actually a comment in the code about this (ObjectArrayList):

  • The actual value in this field is always <code>Object[]</code>, regardless of the
  • generic type used. The JDK is inconsistent here too – {@link ArrayList} declares
  • internal <code>Object[]</code> buffer, but {@link ArrayDeque} declares an array of
  • generic type objects like we do. The tradeoff is probably minimal, but you should
  • be aware of additional casts generated by <code>javac</code>
  • when <code>buffer</code> is directly accessed - these casts may result in exceptions
  • at runtime. A workaround is to cast directly to <code>Object[]</code> before
  • accessing the buffer's elements.

but this can't stay this way indeed, it's weird. I'll look for a workaround.


Issue: HPPC-46 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Feb 17 2011

Cleanup after switching to Maven [HPPC-42]

  • Either change site template to point from the overview page to all reports (pmd, cpd, findbugs, clover) or create a custom overview page. [done, added an overview]
  • Prepare a dir assembly with stuff that should be rsync'ed to labs site. Add a publish profile which rsyncs these to labs (probably via ANT again?).
  • Mavenize other projects in HPPC trunk folder (as sub-modules?).

Issue: HPPC-42 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Mar 01 2011

Change the default hash function in hash set and hash map to MurmurHash. [HPPC-23]

More people will be unaware of the penalty bad data distribution may bring to hash table performance. java.util.HashMap seems to anticipate this too and rehashes whatever keys are given to it internally. HPPC can use a good hashing function as the default and allow folks to use JDK-compliant (or other) hashes if their data distribution is known.

Rename classes to follow the Object* naming scheme as part of this task.


Issue: HPPC-23 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Mar 12 2010

Change addAll(ObjectContainer) to addAll(Iterable<ObjectCursor>) [HPPC-50]

As suggested by Luc Hogie:

Hi Dawid,

One suggestion for improvement:

addAll(ObjectContainer)

should be

addAll(Iterable<ObjectCursor>)

And, for handiness purpose, I think the addAll() method should be defined in ObjectContainer or ObjectCollection.

Luc.


Issue: HPPC-50 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Mar 11 2011

Common interfaces for primitive collections, [HPPC-5]

A set of interfaces for dealing with collections was added to HPPC. The interfaces are similar, but not identical to JCF. In particular, higher-level interfaces only expose iteration over data (iterable, forEach closures) and data removal (removeAll and other methods). Methods adding data to the collection are pushed down to the level of a particular implementation (because their semantics is defined at that level). Example: a queue has addFirst/addLast, but a list has add().


Issue: HPPC-5 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 10 2010

Release 0.1.0 [HPPC-14]

Tasks related to the initial release:

  • JavaDocs

    • Add Carrot Search logo
    • Add Google Analytics
  • Website:

    • Add downloads page
    • Add Google Analytics
    • Add information for Maven users
    • Add social stuff (post on Twitter and Digg buttons)
    • Set up discussion group
    • Add information about the license
    • Add "donate" buttons
    • Automatic syncing of artifacts to the website server

Issue: HPPC-14 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 03 2010

Mavenize project layout [HPPC-41]

Create a mavenized project layout, just to see how it'd compare to the ANT-only version.


Issue: HPPC-41 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Jan 24 2011

Full POM and Maven Central release support [HPPC-43]

Full POM information, including dependencies available via Maven Central so that
no other repositories are needed.

HPPC is now built with Maven (with ANT snippets).


Issue: HPPC-43 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Jan 25 2011

Evaluate fast loop idioms for performance overhead. [HPPC-27]

It's interesting to me that for (IntCursor c : <IntContainer>) is nearly always significantly slower than a simple loop over the indices of a given container. Check why is this the case and what can be done to improve this situation for simple loops.


Issue: HPPC-27 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Apr 27 2010

Implement retainAll() in Lists, Deques and Sets [HPPC-6]

This would make the API more JCF-like. There are two strategies to implement this method:

  • dependent on #48: retainAll() would take an implementation of [type]Collection interface and use its contains() method
  • independent of #48: retainAll() would take a [type]Iterator just like other similar methods and internally use a temporary set (e.g. BitSet) to track the values we want to keep or remove

Issue: HPPC-6 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 10 2010

Add indirect sorting routines to HPPC. [HPPC-21]

Indirect sorting routines are very useful in many applications and they are missing from the JDK. I'll move Carrot2 implementation to HPPC.


Issue: HPPC-21 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Mar 12 2010

Add add(type, type) method to Set [HPPC-7]

This would make the Sets compatible with ArrayLists. We may also want to add the same methods to ArrayDeques (addFirst(type, type), addLast(type, type)).


Issue: HPPC-7 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Feb 19 2010

Predicate-based removal of elements [HPPC-8]

Currently, Lists have the removeAll(type e) method that removes all elements that are equal to e. It would be good to generalize this method to become removeAll([type]Predicate) and have it remove all elements for which the predicate returns true.

Would it make sense to have this method in all Lists, Sets and Deques?


Issue: HPPC-8 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Mar 10 2010
Attachments: HPPC-8.patch

Facilitate arbitrary return values from forEach() calls by returning the argument class. [HPPC-36]

Oh, this is such a neat idea. It is often the case that you need to collect or compute something and then return the value back to the surrounding context. Doing this can be achieved in a number of ways – field reference, shared object, final local array, etc., but a much nicer alternative is to allow the caller to read the result directly from the fields or methods of the argument class. This works even if the argument class is anonymous, as in this example:

int count = container.forEach(new IntProcedure() {
    int count;
    public void apply(int value) { count++; }
}).count;

Changing the current method signatures in forEach is backward compatible.


Issue: HPPC-36 (migrated from JIRA), created by Dawid Weiss (@dweiss), resolved Dec 15 2010

Include support for boolean types [HPPC-2]

One primitive type that is not yet supported is boolean. While some collections involving booleans, such as BooleanSet or BooleanBooleanMap, would be of limited use, some others, such as BooleanList or IntBooleanMap, seem very reasonable.


Issue: HPPC-2 (migrated from JIRA), created by Stanisław Osiński (@stanislawosinski), resolved Feb 18 2010

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.