Comments (16)
What type of application is it?
The application is an event ticketing API
How performance critical is it?
Sometimes we have peaks in numbers of requests, so performance is critical. To improve performance in this scenarios, we are reducing the database calls and removing the aggregation processing from the database and using go-linq to help us with the aggregations processing and with complex/nested objects composition in the API server side, what is easier to scale.
If you are using go-linq since May, you must have used v1. So, can you give any details on migrating to v2?
Unfortunately, I didn't have the chance to migrate to the v2, but I'm considering to make it soon.
from go-linq.
@bsideup it preserves the order when the goroutines are starting, but then result are put into the channel as soon as the job is done. So you may introduce a new parameter, then put it inside the result and use smth like
FromChannel(results).OrderByT(
func(result ResultType) int { return result.Priority },
)
thanks @cleitonmarx for new "-T" methods syntax.
from go-linq.
Hey @frankandrobot, I have been using it in production since May. Works fine! 😃
from go-linq.
@cleitonmarx Thanks for the reply. Can you give any more details on the use case? What type of application is it? How performance critical is it?
If you are using go-linq since May, you must have used v1. So, can you give any details on migrating to v2?
from go-linq.
We use go-linq in http://github.com/zeroturnaround/configo to improve the readability and make it a bit more functional
from go-linq.
@bsideup thanks for the answer. I guess this issue is not something we can “resolve” per se. We have nice changes (like generic functions) coming up with v3, make sure to check the new stuff out!
from go-linq.
@ahmetalpbalkan generic functions? I think you mean interface {}
s everywhere, right?
from go-linq.
@bsideup You can check it out the new generic functions preview here:
https://github.com/ahmetalpbalkan/go-linq/tree/v3-dev#generic-functions
from go-linq.
@cleitonmarx oh, so you decided to implement #26 ? Cool! Will check it soon.
from go-linq.
Yeah and I was thinking this idea sounds familiar lol. We observe 5-15x performance penalty (see benchmark_test.go
) but it yields cleaner code of course.
from go-linq.
@ahmetalpbalkan Errr... looks like AsParallel().AsOrdered().Select(...).AsSequential()
is gone, and with channels API it's totally unclear how to do the same :(
from go-linq.
@bsideup Can you give an example of what you are trying to do?
from go-linq.
@kalaninja sure, luckily it's open sourced:
https://github.com/zeroturnaround/configo/blob/master/sources/composite.go#L27-L38
from go-linq.
@bsideup The "Concurrent" example on our website does mostly the same thing.
The idea is to start a new goroutine per each item manually, output each result to the channel and close the channel when all the goroutines are done. FromChannel()
method waits until the channel is closed to continue iterating the query.
I know that the current syntax is messy, it is more like a workaround. But it gives you more control on what you want to do, and making "plinq" api for the current version is also on our todo list.
from go-linq.
Does it preserve the order?
from go-linq.
Closing as it is now answered.
from go-linq.
Related Issues (20)
- Append方法优化
- "GroupBy has better performance than GroupByT" is written on the document,why?
- ToChannelT release? HOT 2
- why union.go file doesn't have func UnionBy like the func IntersectBy in intersect.go
- Why `ToSlice` need a custom grow strategy instead of the standard library? HOT 1
- runtime error: hash of unhashable type map[string]interface {} HOT 9
- Unit test ExampleOrderedQuery_ThenByDescending fails on golang-1.19.2 HOT 6
- sort result is unexpected HOT 1
- How to implement the full join function of SQL
- new generic functions type HOT 1
- 转换错误 HOT 1
- I expect the data queried using gorm to be converted using go-linq HOT 1
- bug in WhereIndexed HOT 7
- Article comparing performance of go-linq vs others HOT 4
- gopkg.in/ahmetb/go-linq.v3: gopkg.in/ahmetb/[email protected]: parsing go.mod: module declares its path as: github.com/ahmetb/go-linq/v3 but was required as: gopkg.in/ahmetb/go-linq.v3 HOT 5
- how about add parameter timeout for FromChannelT?
- Try out the new Go generics proposal with go-linq HOT 14
- Is it safe to copy in multiple concurrency HOT 2
- How to implement complex SQL functions HOT 5
- PLINQ support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-linq.