Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package markdown
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
func llm(b *testing.B) string {
|
|
data, err := os.ReadFile("parser/testdata/llm.md")
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
return string(data)
|
|
}
|
|
|
|
// BenchmarkViewSteady draws frames of the 50 KB answer shown whole, in a
|
|
// window of 800 by 1000, as nothing changes.
|
|
func BenchmarkViewSteady(b *testing.B) {
|
|
src := llm(b)
|
|
tt := ui.NewTester(func(c *ui.Context) {
|
|
ui.Scroll(c).Fill().Children(func() { View(c, src, nil) })
|
|
}, 800, 1000)
|
|
b.ReportAllocs()
|
|
for b.Loop() {
|
|
tt.Frame()
|
|
}
|
|
}
|
|
|
|
// BenchmarkViewStream draws the frames of the 50 KB answer streaming in,
|
|
// 16 bytes a frame, as a chat follows a reply's end; it reports the time
|
|
// of a frame with its token.
|
|
func BenchmarkViewStream(b *testing.B) {
|
|
src := llm(b)
|
|
o := &Options{Reveal: &Reveal{Unit: AtOnce}}
|
|
n := 0
|
|
tt := ui.NewTester(func(c *ui.Context) {
|
|
ui.Scroll(c).Fill().Children(func() { Stream(c, src[:n], o) })
|
|
}, 800, 1000)
|
|
b.ReportAllocs()
|
|
for b.Loop() {
|
|
n += 16
|
|
if n > len(src) {
|
|
n = 16
|
|
}
|
|
tt.Frame()
|
|
}
|
|
}
|