-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
300 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2024 Objectionary.com | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
--- | ||
name: benchmark | ||
'on': | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
benchmark: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 21 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ubuntu-jdk-21-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
ubuntu-jdk-21-maven- | ||
- run: mvn clean test -Dtest=OptimizeMojoTest#optimizesJustOneLargeJnaClass --errors --batch-mode | ||
- run: | | ||
sum=$(cat target/jna-summary.txt) | ||
perl -i -pe "s/<!-- benchmark_begin -->.*<!-- benchmark_end -->/${sum}/g" README.md | ||
- uses: peter-evans/create-pull-request@v7 | ||
with: | ||
branch: benchmark | ||
commit-message: 'new benchmark results' | ||
delete-branch: true | ||
title: 'New benchmarking results' | ||
assignees: yegor256 | ||
base: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2024 Objectionary.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.eolang.hone; | ||
|
||
import com.jcabi.log.Logger; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.StandardOpenOption; | ||
|
||
/** | ||
* Timings. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
final class Timings { | ||
|
||
/** | ||
* Path of the file. | ||
*/ | ||
private final Path path; | ||
|
||
/** | ||
* Ctor. | ||
* @param file Location of the CSV file to modify | ||
*/ | ||
Timings(final Path file) { | ||
this.path = file; | ||
} | ||
|
||
/** | ||
* Run and record. | ||
* @param name Name of the action | ||
* @param action The action | ||
* @throws IOException If fails | ||
*/ | ||
public void through(final String name, final Timings.Action action) throws IOException { | ||
final long start = System.currentTimeMillis(); | ||
try { | ||
action.exec(); | ||
} finally { | ||
final File dir = this.path.toFile().getParentFile(); | ||
if (dir.mkdirs()) { | ||
Logger.debug(this, "Directory created: %[file]s", dir); | ||
} | ||
Files.write( | ||
this.path, | ||
String.format( | ||
"%s,%d\n", name, System.currentTimeMillis() - start | ||
).getBytes(), | ||
StandardOpenOption.APPEND, StandardOpenOption.CREATE | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* What to do. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public interface Action { | ||
/** | ||
* Exec it. | ||
* @throws IOException If fails | ||
*/ | ||
void exec() throws IOException; | ||
} | ||
|
||
} |
Oops, something went wrong.