Comments (5)
I do expect developers to read these entries in git, so I would like to make it prettified JSON if possible.
I also want to benchmark before/after change: I think that because YAML is a superset of JSON, it should be slower to read and write. So there is hopefully a performance boost from this change, however that's not the main goal.
from changes.
Before changes
8.63 real 38.94 user 19.56 sys
52031488 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
35750 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
55 voluntary context switches
938736 involuntary context switches
114957983162 instructions retired
192027128118 cycles elapsed
45723648 peak memory footprint
After changes
8.52 real 35.95 user 19.82 sys
64073728 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
38685 page reclaims
0 page faults
0 swaps
0 block input operations
0 block output operations
0 messages sent
0 messages received
0 signals received
55 voluntary context switches
989654 involuntary context switches
108821228655 instructions retired
182934096805 cycles elapsed
57688064 peak memory footprint
from changes.
So in terms of performance...not that different. JSONDecoder is known to be pretty slow in general (for a json decoder) so I guess this shouldn't surprise me. Also, Codable may be the slowest thing in this process
from changes.
Benchmark code
import Files
import Foundation
import Yams
import Version
struct Temp: ParsableCommand {
static var configuration = CommandConfiguration(
commandName: "temp",
abstract: ""
)
func run() throws {
let loadedConfig = try ConfigurationLoader().load()
guard let workingFolder = try File(path: loadedConfig.path).parent else {
throw ChangesError("Could not find folder of changes config.")
}
let releasesFolder = try workingFolder.createSubfolderIfNeeded(
at: ".changes/releases"
)
let encoder = JSONEncoder()
for i in 0..<500 {
let releaseFolder = try releasesFolder.createSubfolderIfNeeded(at: "1.0.\(i)")
let info = ReleaseInfo(version: try! Version("1.0.\(i)"), createdAtDate: Date())
let infoData = try encoder.encode(info)
try releaseFolder.createFile(named: "info.json").write(infoData)
let subfolder = try releaseFolder.createSubfolderIfNeeded(at: "entries")
for _ in 0..<100 {
let entry = ChangelogEntry(
tags: ["Added", "Removed"],
description: "This is a description",
createdAtDate: Date()
)
let output = try encoder.encode(entry)
try subfolder.createFile(named: "\(UUID().uuidString).json").write(output)
}
}
}
}
from changes.
Tried to use ikigajson for fun to see if it'd speed it up but it just crashed.
from changes.
Related Issues (20)
- Use swiftenv for macOS github workflow
- Build changelog with Stencil HOT 2
- Name changes files by id and add id field HOT 1
- Build README with stencil HOT 1
- How to avoid interactive mode on CI HOT 3
- Add ability to query Changs by id HOT 1
- Automate linux docker image names
- Should this library allow tracing?
- All printing should to go stderr
- Polish help commands
- Display query output in human readable format
- Put queries under `query` subcommand HOT 1
- Output on success for non-query commands
- Review possible files errors and provide helpful output for common errors HOT 1
- Relocate config file?
- Upgrade to Swift 5.5 & Async/Await HOT 1
- Add apiVersion to changes config and changes files
- How do we handle multiple release builds and versions in the same repo? HOT 2
- Should releases be a part of this project? HOT 2
- Create some way to add files with changes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from changes.