Update the fnr-exploration doc
Esse commit está contido em:
@@ -88,3 +88,67 @@ How much faster is it with out markers and no decorations?
|
||||
Whoa. Now, it's all about finding the position in char range. The GC isnt even in the picture.
|
||||
|
||||

|
||||
|
||||
## Optimizing Marker creation
|
||||
|
||||
So our largest chunk of time is spent creating markers. How slow is marker creation compared to regular object creation + emit
|
||||
|
||||

|
||||
|
||||
It's a lot slower.
|
||||
|
||||
This The profile for marker-creation:
|
||||
|
||||

|
||||
|
||||
The profile looked like we were spending some time in `Range.toObject`. Is there a difference between `new Range(new Point(row, 0), new Point(row, 1))` and `[[row, 0], [row, 1]]`? Yeah, and it's pretty big
|
||||
|
||||

|
||||
|
||||
Could optimize it to not use `args...`? __YES__
|
||||
|
||||
```coffee
|
||||
@fromObject: (object, copy) ->
|
||||
if Array.isArray(object)
|
||||
new this(...)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```coffee
|
||||
@fromObject: (object, copy) ->
|
||||
if Array.isArray(object)
|
||||
[pointA, pointB] = object
|
||||
new this(pointA, pointB)
|
||||
```
|
||||
|
||||
And now they are equal performance!
|
||||
|
||||

|
||||
|
||||
### Marker creation in Atom vs TextBuffer
|
||||
|
||||
Creation is fast on the text-buffer side, and ~3x+ slower on the atom side. What are we doing?
|
||||
|
||||

|
||||
|
||||
Looks like we're spending a lot more time (~4x!) in the garbage collector and a whole lot more time emitting events.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Subscribing is slow
|
||||
|
||||
Commenting out the changed and destroyed handlers in `DisplayBufferMarker` cut the time in _half_.
|
||||
|
||||
```coffee
|
||||
# @subscribe @bufferMarker, 'destroyed', => @destroyed()
|
||||
# @subscribe @bufferMarker, 'changed', (event) => @notifyObservers(event)
|
||||
```
|
||||
|
||||

|
||||
|
||||
Even using `on` rather than subscribe is faster:
|
||||
|
||||

|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário