improve performance for class-only changes; improves #40 but doesn't fix the real underlying combinatorial explosion
This commit is contained in:
parent
4be45499f7
commit
0ddf6098f7
2 changed files with 6 additions and 5 deletions
|
|
@ -93,7 +93,7 @@ when defined(js):
|
|||
n[0] = ident("inner" & nn)
|
||||
var unpackCall = newCall(n[0])
|
||||
var counter = 0
|
||||
for i in 1.. <params.len:
|
||||
for i in 1 ..< params.len:
|
||||
let param = params[i]
|
||||
let L = param.len
|
||||
let typ = param[L-2]
|
||||
|
|
|
|||
|
|
@ -245,10 +245,10 @@ proc eq(a, b: VNode): EqResult =
|
|||
when defined(profileKarax): inc reasons[deComponent]
|
||||
return different
|
||||
return componentsIdentical
|
||||
if a.class != b.class:
|
||||
when defined(profileKarax): inc reasons[deClass]
|
||||
return different
|
||||
if not eq(a.style, b.style) or not sameAttrs(a, b):
|
||||
#if:
|
||||
# when defined(profileKarax): inc reasons[deClass]
|
||||
# return different
|
||||
if a.class != b.class or not eq(a.style, b.style) or not sameAttrs(a, b):
|
||||
when defined(profileKarax): inc reasons[deSimilar]
|
||||
return similar
|
||||
# Do not test event listeners here!
|
||||
|
|
@ -260,6 +260,7 @@ proc updateStyles(newNode, oldNode: VNode) =
|
|||
if newNode.style != nil: applyStyle(oldNode.dom, newNode.style)
|
||||
else: oldNode.dom.style = Style()
|
||||
oldNode.style = newNode.style
|
||||
oldNode.class = newNode.class
|
||||
|
||||
proc updateAttributes(newNode, oldNode: VNode) =
|
||||
# we keep the oldNode, but take over the attributes from the new node:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue