Giter Club home page Giter Club logo

Comments (4)

CalebFenton avatar CalebFenton commented on June 10, 2024

Sorry for the slow reply. Apparently, I wasn't configured to "watch" this repo and didn't get notified.

  1. Yeah, it should be thread safe. I really only ever use it in a multi-threaded, daemon mode, and I designed it with threads in mind. There's very little shared state (possibly none)
  2. I use LinkedLists when I want to minimize list size and list elements don't need to be randomly accessible. If you see a place using LinkedList, but items are frequently accessed by index (other than 0), feel free to submit a PR. I only use ArrayLists when I need fast random access, but most of the time I just need a list of things that I can append to and then eventually sequentially iterate.

Going to close this, but feel free to continue the conversations. I'm watching this project now.

from apkfile.

benldrmn avatar benldrmn commented on June 10, 2024

Hi, that's alright.

Regarding LinkedLists vs ArrayLists, ArraysLists not only shine when random access to the data structure is needed, but also when iterating over it sequentially, as the data is saved sequentially in the memory (as opposed to LinkedList where it's scattered all over), and thus the iteration is so much faster due to less cache misses. Every time you access read an entry in the array, you read a whole cache line from the RAM which has other entries in it as well (as they are close-by to the entry you just read due to the nature of an array and how the data is stored in memory) and thus you have the next array entries already in cache which is ridiculously faster than RAM. So iterating ArraysList sequentially is much more cache-friendly than iterating LinkedLists where every iteration would probably cause a cache-miss.

What are you thoughts about that?

from apkfile.

CalebFenton avatar CalebFenton commented on June 10, 2024

Can you point to some benchmarks showing sequential access is faster for ArrayLists? I did some quick poking around and it seems like there's a lot of debate over when to prefer Linked vs Array. I think the only way to know for sure would be to benchmark and profile similar code or apkfile itself.

I'm curious and would be open to changing it if I knew it was better. Should be possible to benchmark against a large sample set to establish baseline. Then, replace everything with ArrayList, run same set again and compare speed and memory performance. Want to give it a shot?

from apkfile.

benldrmn avatar benldrmn commented on June 10, 2024

I agree that when talking performence, you got to measure things. I'm quite busy at the time but I will try to find some time to benchmark it.

from apkfile.

Related Issues (7)

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.