`stdLambda` performance re-visited
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- visualbasic
- Lĩnh vực
- performance
Hướng nghiên cứu
The issue provides a VBA benchmark comparing stdLambda with clsMathParser, but names no source files or tests. Start by reproducing the supplied benchmark and reading the stdLambda implementation and commit 2a9b2e0. Done is not defined; the issue suggests investigating a pre-populated stack and other performance differences without selecting a concrete change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
stdLambda Performance
It has come to my attention that there exists another library a lot like stdLambda, named clsMathParser. This library apparently existed since 2004(?!), so totally unsure how this skipped passed my radar! It's not a very intuitive library but essentially functions as follows:
With new clsMathParser
.storeExpression("x+1")
For i = 1 to 100
variable("x") = i
Debug.Print .eval()
next
End With
This library is, according to my testing, 5x vaster than stdLambda. Test set:
Sub test()
Dim math As New clsMathParser
Dim lambda As stdLambda: Set lambda = stdLambda.Create("$1^2+$1+2")
If math.StoreExpression("x^2+x+2") Then
With stdPerformance.Measure("clsMathParser", 10000)
Dim i As Double, l As Double
For i = 1 To 1000000
math.variable("x") = i / 1000
l = math.Eval()
Next
End With
With stdPerformance.Measure("stdLambda", 10000)
For i = 1 To 1000000
l = lambda.Run(i / 1000)
Next
End With
End If
End Sub
Comparrison of algorithm
clsMathParser's stack is pre-populated with values paired with operators. This ultimately means less operations done in VBA side:clsMathParsersplitsx^2+x+2into 3 operations:ET(0)= completion opET(1)=^prevArg + varX^2(???)ET(2)=+prevArg + varXET(3)=+0+2
stdLambdasplits$1^2+$1+2into 7 operationsops(0)= Arg 1ops(1)= Push 2ops(2)= Op Powops(3)= Arg 1ops(4)= Op Addops(5)= Push 2ops(6)= Op Addops(7)= Completion
stdLambda's starts with an empty stack and alocates it with values at runtime. Though we're only copying a few bytes I guess this consumes a lot of time compared to having all that data pre-prepared. A pre-populated stack is something we should likely look into.stdLambdaused to be copying argument location from a string at runtime, which is slow! I changed this and it saves some 30µs per operation. Fixed in 2a9b2e0clsMathParserisn't stand alone sadly, and doesn't provide object access.stdLambdadoes provide object access and is standalone by comparrison (although technically requiresstdICallable- easily removed by comparrison)- Cleverly
clsMathParseruses aByRefparam for the return type. That shaves off some time, although not significant in my tests. But still clever fosho :)
- Ngôn ngữ chính
- VBA
- Star
- 412
- Fork
- 70
- Merge trung bình
- 17 giờ 22 phút
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sancarn/stdVBA
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
sancarn/stdVBA#140 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
sancarn/stdVBA#138 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement lib-stdArray
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`stdUIElement` megathreadĐang mởenhancement megathread
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sancarn/stdVBA
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ccch1mneyyy/dsh-TUI#1839 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Scrollbar does not clear its resize timer on dispose, keeping a closed tab strip alive for 500 msĐang mởbug triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
-
enhancement performance rust
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] With io-threads > 1, an idle server keeps restarting an I/O thread after a load burst (ignition averages samples from before the last ignition)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày