mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-10-28 18:13:54 +01:00
update to Scinitlla Release 5.3.5 (https://www.scintilla.org/scintilla535.zip) Released 31 May 2023. On Win32, implement IME context sensitivity with IMR_DOCUMENTFEED. Feature #1310. On Win32 remove dependence on MSIMG32.DLL by replacing AlphaBlend by GdiAlphaBlend. Bug #1923. On Qt, stop movement of IME candidate box. On Qt, report correct caret position within paragraph for IME retrieve surrounding text. On Qt for Cocoa, fix crash in entry of multi-character strings with IME. and Lexilla Release 5.2.5 (https://www.scintilla.org/lexilla525.zip) Released 31 May 2023. Add CharacterSetArray constructor without setBase initial argument for common case where this is setNone and the initialSet argument completely defines the characters. This shortens and clarifies use of CharacterSetArray. Bash: implement highlighting inside quoted elements and here-docs. Controlled with properties lexer.bash.styling.inside.string, lexer.bash.styling.inside.backticks, lexer.bash.styling.inside.parameter, and lexer.bash.styling.inside.heredoc. Issue #154, Issue #153, Feature #1033. Bash: add property lexer.bash.command.substitution to choose how to style command substitutions. 0 → SCE_SH_BACKTICKS; 1 → surrounding "$(" and ")" as operators and contents styled as bash code; 2 → use distinct styles (base style + 64) for contents. Choice (2) is a provisional feature and details may change before it is finalized. Issue #153. Bash: fix nesting of parameters (SCE_SH_PARAM) like ${var/$sub/"${rep}}"}. Issue #154. Bash: fix single character special parameters like $? by limiting style. Issue #154. Bash: treat "$$" as special parameter and end scalars before "$". Issue #154. Bash: treat "<<" in arithmetic contexts as left bitwise shift operator instead of here-doc. Issue #137. Batch: style SCE_BAT_AFTER_LABEL used for rest of line after label which is not executed. Issue #148. F#: Lex interpolated verbatim strings as verbatim. Issue #156. VB: allow multiline strings when lexer.vb.strings.multiline set. Issue #151. Close #13729
150 lines
4.5 KiB
Python
150 lines
4.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
# Requires Python 2.7 or later
|
|
|
|
from __future__ import with_statement
|
|
from __future__ import unicode_literals
|
|
|
|
import string, time, unittest
|
|
|
|
try:
|
|
start = time.perf_counter()
|
|
timer = time.perf_counter
|
|
except AttributeError:
|
|
timer = time.time
|
|
|
|
import XiteWin as Xite
|
|
|
|
class TestPerformance(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.xite = Xite.xiteFrame
|
|
self.ed = self.xite.ed
|
|
self.ed.ClearAll()
|
|
self.ed.EmptyUndoBuffer()
|
|
|
|
def testAddLine(self):
|
|
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
|
start = timer()
|
|
for i in range(2000):
|
|
self.ed.AddText(len(data), data)
|
|
self.assertEquals(self.ed.LineCount, i + 2)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testAddLine" % duration)
|
|
self.xite.DoEvents()
|
|
self.assert_(self.ed.Length > 0)
|
|
|
|
def testAddLineMiddle(self):
|
|
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
|
start = timer()
|
|
for i in range(2000):
|
|
self.ed.AddText(len(data), data)
|
|
self.assertEquals(self.ed.LineCount, i + 2)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testAddLineMiddle" % duration)
|
|
self.xite.DoEvents()
|
|
self.assert_(self.ed.Length > 0)
|
|
|
|
def testHuge(self):
|
|
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
|
data = data * 100000
|
|
start = timer()
|
|
self.ed.AddText(len(data), data)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testHuge" % duration)
|
|
self.xite.DoEvents()
|
|
self.assert_(self.ed.Length > 0)
|
|
|
|
def testHugeInserts(self):
|
|
data = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
|
data = data * 100000
|
|
insert = (string.digits + "\n").encode('utf-8')
|
|
self.ed.AddText(len(data), data)
|
|
start = timer()
|
|
for i in range(2000):
|
|
self.ed.InsertText(0, insert)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testHugeInserts" % duration)
|
|
self.xite.DoEvents()
|
|
self.assert_(self.ed.Length > 0)
|
|
|
|
def testHugeReplace(self):
|
|
oneLine = (string.ascii_letters + string.digits + "\n").encode('utf-8')
|
|
data = oneLine * 100000
|
|
insert = (string.digits + "\n").encode('utf-8')
|
|
self.ed.AddText(len(data), data)
|
|
start = timer()
|
|
for i in range(1000):
|
|
self.ed.TargetStart = i * len(insert)
|
|
self.ed.TargetEnd = self.ed.TargetStart + len(oneLine)
|
|
self.ed.ReplaceTarget(len(insert), insert)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testHugeReplace" % duration)
|
|
self.xite.DoEvents()
|
|
self.assert_(self.ed.Length > 0)
|
|
|
|
def testUTF8CaseSearches(self):
|
|
self.ed.SetCodePage(65001)
|
|
oneLine = "Fold Margin=折りたたみ表示用の余白(&F)\n".encode('utf-8')
|
|
manyLines = oneLine * 100000
|
|
manyLines = manyLines + "φ\n".encode('utf-8')
|
|
self.ed.AddText(len(manyLines), manyLines)
|
|
searchString = "φ".encode('utf-8')
|
|
start = timer()
|
|
for i in range(1000):
|
|
self.ed.TargetStart = 0
|
|
self.ed.TargetEnd = self.ed.Length-1
|
|
self.ed.SearchFlags = self.ed.SCFIND_MATCHCASE
|
|
pos = self.ed.SearchInTarget(len(searchString), searchString)
|
|
self.assert_(pos > 0)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testUTF8CaseSearches" % duration)
|
|
self.xite.DoEvents()
|
|
|
|
def testUTF8Searches(self):
|
|
self.ed.SetCodePage(65001)
|
|
oneLine = "Fold Margin=折りたたみ表示用の余白(&F)\n".encode('utf-8')
|
|
manyLines = oneLine * 100000
|
|
manyLines = manyLines + "φ\n".encode('utf-8')
|
|
self.ed.AddText(len(manyLines), manyLines)
|
|
searchString = "φ".encode('utf-8')
|
|
start = timer()
|
|
for i in range(20):
|
|
self.ed.TargetStart = 0
|
|
self.ed.TargetEnd = self.ed.Length-1
|
|
self.ed.SearchFlags = 0
|
|
pos = self.ed.SearchInTarget(len(searchString), searchString)
|
|
self.assert_(pos > 0)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testUTF8Searches" % duration)
|
|
self.xite.DoEvents()
|
|
|
|
def testUTF8AsciiSearches(self):
|
|
self.ed.SetCodePage(65001)
|
|
oneLine = "Fold Margin=NagasakiOsakaHiroshimaHanedaKyoto(&F)\n".encode('utf-8')
|
|
manyLines = oneLine * 100000
|
|
manyLines = manyLines + "φ\n".encode('utf-8')
|
|
self.ed.AddText(len(manyLines), manyLines)
|
|
searchString = "φ".encode('utf-8')
|
|
start = timer()
|
|
for i in range(20):
|
|
self.ed.TargetStart = 0
|
|
self.ed.TargetEnd = self.ed.Length-1
|
|
self.ed.SearchFlags = 0
|
|
pos = self.ed.SearchInTarget(len(searchString), searchString)
|
|
self.assert_(pos > 0)
|
|
end = timer()
|
|
duration = end - start
|
|
print("%6.3f testUTF8AsciiSearches" % duration)
|
|
self.xite.DoEvents()
|
|
|
|
if __name__ == '__main__':
|
|
Xite.main("performanceTests")
|