Comments (11)
I know that package:watcher
is a separate problem, but I just want to give you some additional numbers, because they may be interesting in the context of package:path
.
Even with our AbsolutePathContext
we have some significant use of package:path
, accounting for about 12%
of total time.
BTW, the difference before the previous and this performance profiler is cause by the fact that I turned off our internal logging. Most of the users don't have it on, so that's what they see.
from path.
Can you provide some example arguments that you provide to relative()
and isWithin()
?
from path.
relative()
is mostly called from isWithin()
with the arguments as in the attached file.
The rest is called from package:glob
with the similar set of second argument paths and patterns like samples/**
and lib/_templates/**
.
from path.
Thank you for filing this bug! Details like this are really helpful when optimizing.
from path.
@scheglov Does the performance improvement from my latest patch meet your needs? I benchmarked it as about 11.5x faster on the data you provided.
from path.
When I upgrade to the version 1.3.8
, and reimplement AbsolutePathContext
using the path
package, I see 30%
performance loss. The analysis time goes up from 3000 ms
to 4000 ms
. The functions isWithin
and relative
consume a significant part of the total analysis time.
I will e-mail you the complete list of parent/child pairs used for isWithin
.
from path.
30% relative to path
1.3.7, or relative to the current implementation of AbsolutePathContext
? We're never going to be able to match AbsolutePathContext
's performance, because its functions sacrifice correctness for speed and that's not a bargain the path package can make.
from path.
That said, looking at your test data, it looks like we're not hitting the fast track when one of the paths contains /.
, including situations like path/.pub-cache
. That's definitely something we can improve.
from path.
The whole analysis time is 30%
more than with the current implementation of AbsolutePathContext
.
This mean that the path
package itself is much slower than AbsolutePathContext
.
We cannot sacrifice so much performance just because path
cannot be fast. Why would we check and recheck whether the given paths are absolute and don't have ..
when we already know this? The fastest code is the code you don't need to execute at all.
That said, I still don't believe that the current path
implementation is the most optimal one.
It's not even close to this. For example I don't believe that we need to use isRelative
and split
to implement isWithin
for absolute paths.
from path.
Okay, I think my latest patch should be good enough. It fixes the /.
loophole, so on your example pairs, it's about 8x faster than the 1.8.7 implementation. Observatory indicates that CodeUnits.[]
is about a third of the overall performance, which I think is a pretty good place to be.
from path.
Yes, it's much better.
Thank you!
With switching to the path
package Analysis Server is still 10%
slower though.
At this point it does not seem too bad, but I cannot decide whether we want to take this performance hit or not.
from path.
Related Issues (20)
- package website unreachable HOT 1
- Windows paths shouldn't be canonicalized to lower-case HOT 2
- Exception: NoSuchMethodError: The method 'pathFromUri' was called on null. HOT 4
- Support \\?\ prefix in UNC Windows paths HOT 2
- [Question] Is it possible to enforce style or context? HOT 1
- please support package's protocol path HOT 1
- setExtension removes part of a filename if it contained dot
- setExtension removes part of a filename if it contained dot HOT 1
- flutter_test from sdk depends on path 1.8.0 HOT 8
- `isWithin` has surprising behavior when `base` ends with `/.` and `child` starts with `.` HOT 1
- does not parse ~ HOT 1
- Version 1.8.1. `path.posix` has many bugs. HOT 1
- Error by installing path 1.8.1 HOT 1
- version solving failed HOT 1
- Why does .dirname(String) return '.' instead of '' when passed an empty (non-null) string HOT 1
- Getting `version solving failed` with using 1.8.3 version HOT 1
- isAbsolute(r'\') should return false for Windows-style filesystem HOT 4
- pathContext.fromUri() mishandles encoded colons after drive letters HOT 4
- join() not working as advertised
- Can the latest version be compatible with the latest stable version of Flutter? HOT 4
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 path.