mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-03 21:52:31 +02:00
Testing if interning pubkeys and ids help save some memory.
This commit is contained in:
@@ -13,6 +13,34 @@ class EventFactory {
|
||||
content: String,
|
||||
sig: String,
|
||||
lenient: Boolean
|
||||
): Event {
|
||||
val internedTags = tags.map {
|
||||
it.map {
|
||||
it.intern()
|
||||
}
|
||||
}
|
||||
|
||||
return internedCreate(
|
||||
id = id.intern(),
|
||||
pubKey = pubKey.intern(),
|
||||
createdAt = createdAt,
|
||||
kind = kind,
|
||||
tags = internedTags,
|
||||
content = content,
|
||||
sig = sig,
|
||||
lenient = lenient
|
||||
)
|
||||
}
|
||||
|
||||
fun internedCreate(
|
||||
id: String,
|
||||
pubKey: String,
|
||||
createdAt: Long,
|
||||
kind: Int,
|
||||
tags: List<List<String>>,
|
||||
content: String,
|
||||
sig: String,
|
||||
lenient: Boolean
|
||||
) = when (kind) {
|
||||
AppDefinitionEvent.kind -> AppDefinitionEvent(id, pubKey, createdAt, tags, content, sig)
|
||||
AppRecommendationEvent.kind -> AppRecommendationEvent(id, pubKey, createdAt, tags, content, sig)
|
||||
|
Reference in New Issue
Block a user