3 ms·
I would recommend people to use a persistent collection library like Vavr instead (many other options too). It provides the same functionality but without stri
by joncampbelldev 9y ago
I would recommend people to use a persistent collection library like Vavr instead (many other options too).
It provides the same functionality but without string field references (a disaster for refactoring). Additionally it won't require learning a new DSL for basic comparisons because the logic is contained in normal Java code with lambdas and method references.
this:
Gather query = Gather.where("age").greaterThan(50).and("status").is("active");
List<Employee> filtered = query.find(employees);
becomes this:
List<Employee> filtered = employess.filter(e -> e.age > 50 && e.status.equals("active"));
- sangupta 9y agoGather was aimed at JDK 7 since there is still a lot of legacy code around. For JDK 8, lambdas surely work better.
- joncampbelldev 9y agoFair enough, what's the performance hit of reflection like for larger collection sizes? is this library intended for exploring data during development or a production system?
- sangupta 9y agoI haven't done performance benchmarking, nor tuned it yet. That's my next plan. The library is largely meant for firing ad-hoc queries in production, or for tweaking data-sets and database queries. Though reflection is slower, it allows us to fire queries on List<Object> sort of collections and the built in type conversions may allow us to compare a Calendar instance to a Date, or a Long to a String (with implicit parsing and conversions).
- deleted 9y ago[deleted]
- sangupta 9y agoI ran some performance tests and added a basic caching layer on reflection - that improved it by around 50% in the very basic of tests. You may look at the results in README at https://github.com/sangupta/gather https://github.com/sangupta/gather repo.