Commit Graph

11 Commits

Author SHA1 Message Date
Mathias Agopian
6ee20a57aa remove all uses of our custom spinlock
This has caused issues and over time we have reduced the use of 
spinlocks, it was only used in few places and we still have evidence
that it's causing ANRs.

We use utils::Mutex instead which is a low overhead mutex implementation
on Linux systems.

FIXES=[321101014]
2024-01-19 12:05:07 -08:00
Mathias Agopian
718e7ab064 remove a bunch of <functional> includes
This forces us to use an explicit hash class in a few place, but it
is cleaner.

remove utils::lower_bound and utils::upper_bound, which were not used.
2022-06-03 08:35:57 -07:00
Ben Doherty
64c5dc63ab Audit usage of UTILS_PUBLIC and fix bluegl linking warning (#3988) 2021-07-12 17:09:13 -07:00
Mathias Agopian
bbc4f4f21d JobSystem: remove the DONT_SIGNAL flag
A side effect of this flag was that we had to always use notify_all
when starting a job, instead of notify_one -- in practice, we found
experimentally that more calls to notify_one is cheaper than fewer
calls to notify_all.
2021-06-08 09:47:16 -07:00
Pixelflinger
8170ca7cd1 improve JobSystem::parallel_for + minor optimizations
- parallel_for doesn't use recursion anymore to create the "leaf"
jobs, this is now done linearly on N thread (one thread per CPU).
This uses less stack space, and reduces miss-predicted branches.

- remove almost all SYSTRACE calls because they have a huge impact
on things like parallel_for() and are misleading. They can be
enabled again by setting HEAVY_SYSTRACE to true.
2019-07-09 16:12:15 -07:00
Mathias Agopian
31745f6025 fix benchamrk JobSystem de-initialization
JobSystem's API requires to call emancipate() for each adopt() before
destroying the JobSystem.
2019-07-01 14:25:26 -07:00
Mathias Agopian
cfb9c03226 Improve JobSystem, especially under contention
- only signal waitAndRelease() when the corresponding job finishes and
only if there is waitAndRelease() active -- instead of signaling 
every time a job ends.

- don't surrender time slice when attempting to steal a job and it fails
as long as some queue has jobs.

- check that we have to wait, because taking the lock

- add a benchmark

This change more than doubles the amount of jobs we can handle per
second (~965,000 jobs/s on Pixel3)
2018-12-14 16:01:17 -08:00
Mathias Agopian
e8895fee11 Add a binary search benchmark
this one basically shows that the stl is is a good as our "branch less"
versions. this is because clang generate branchless code in the end.
2018-11-29 11:44:52 -08:00
Mathias Agopian
785ce645e2 pool allocators benchmark
this benchmark shows that, as we expected, on Android mutexes,
spinlocks and lock-free algorithms are running at similar performance.
2018-11-29 11:44:52 -08:00
Mathias Agopian
05854e0d05 port the "filament_calls" benchmark to google benchmark 2018-11-27 15:07:45 -08:00
Pixelflinger
cf4410f656 Add some libutils benchmarks 2018-11-26 11:51:17 -08:00