Giter VIP home page Giter VIP logo

Comments (3)

RobAustin avatar RobAustin commented on July 19, 2024

In most cases you can replace your use of HugeHashMap with ChronicleMap, could you try using ChronicleMap.

We are focusing most of our new development and support effort on ChronicleMap.

On 27 Oct 2014, at 10:49, Mesutcan Kurt [email protected] wrote:

I attached a profiler to my application and I saw that call tree:

https://cloud.githubusercontent.com/assets/439170/4789483/9a28a160-5dc5-11e4-9c8f-efffd151d9ba.png
I invoked Map.get() 8379 times and also net.openhft.collections.HugeHashMap$Segment.get is invoked same amount but Segment.getKey() is invoked 9.903.392 times.

Why getKey() invocation count is more about 1000 times than Map.get() count?

My get code:

for (Long key : cache.keySet()) {
sr = cache.get(key);

if (sr != null && sr.isDirty() && sr.isInDb()) {
    ++updateCount;

    sr.setClean();
    try {
        cache.put(key, sr);
    } catch (Exception e) {
    // discard
    }
}

}


Reply to this email directly or view it on GitHub #45.

from hugecollections-old.

peter-lawrey avatar peter-lawrey commented on July 19, 2024

If you want to iterate over the entries of any Map (not just ours) the most
efficient means is to use entrySet()

e.g.

for (Map.Entry<Long, SR> entry: cache.entrySet()) {

as you can see there is no need to lookup the entry via get()

BTW We have a means of efficiently persisting a Map to a JDBC connection,
perhaps you try this means of "replication"

On 27 October 2014 10:49, Mesutcan Kurt [email protected] wrote:

I attached a profiler to my application and I saw that call tree:

[image: image]
https://cloud.githubusercontent.com/assets/439170/4789483/9a28a160-5dc5-11e4-9c8f-efffd151d9ba.png

I invoked Map.get() 8379 times and also
net.openhft.collections.HugeHashMap$Segment.get is invoked same amount but
Segment.getKey() is invoked 9.903.392 times.

Why getKey() invocation count is more about 1000 times than Map.get()
count?

My get code:

for (Long key : cache.keySet()) {
sr = cache.get(key);

if (sr != null && sr.isDirty() && sr.isInDb()) {
    ++updateCount;

    sr.setClean();
    try {
        cache.put(key, sr);
    } catch (Exception e) {
    // discard
    }
}}


Reply to this email directly or view it on GitHub
#45.

from hugecollections-old.

peter-lawrey avatar peter-lawrey commented on July 19, 2024

BTW This could happen if you HugeHashMap is very full. (i.e. it is heavily
loaded compared to it's capacity)
When this happens, you might find a very large number of lookups are
performed to find each key.

On 27 October 2014 10:49, Mesutcan Kurt [email protected] wrote:

I attached a profiler to my application and I saw that call tree:

[image: image]
https://cloud.githubusercontent.com/assets/439170/4789483/9a28a160-5dc5-11e4-9c8f-efffd151d9ba.png

I invoked Map.get() 8379 times and also
net.openhft.collections.HugeHashMap$Segment.get is invoked same amount but
Segment.getKey() is invoked 9.903.392 times.

Why getKey() invocation count is more about 1000 times than Map.get()
count?

My get code:

for (Long key : cache.keySet()) {
sr = cache.get(key);

if (sr != null && sr.isDirty() && sr.isInDb()) {
    ++updateCount;

    sr.setClean();
    try {
        cache.put(key, sr);
    } catch (Exception e) {
    // discard
    }
}}


Reply to this email directly or view it on GitHub
#45.

from hugecollections-old.

Related Issues (20)

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.