Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Rename bliss-rs & limit bliss resource usage
Browse files Browse the repository at this point in the history
  • Loading branch information
NGnius committed Mar 27, 2022
1 parent fb80a06 commit 327ab6e
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 68 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ codegen-units = 4
[profile.bench]
lto = false

[profile.dev.package.bliss-audio]
[profile.dev.package.bliss-audio-symphonia]
debug-assertions = false
overflow-checks = false
debug = true
Expand Down
2 changes: 1 addition & 1 deletion bliss-rs
Submodule bliss-rs updated 2 files
+3 −3 Cargo.toml
+5 −10 README.md
5 changes: 3 additions & 2 deletions mps-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.7.0"
edition = "2021"
license = "LGPL-2.1-only OR GPL-3.0-only"
readme = "README.md"
rust-version = "1.59"

[dependencies]
rusqlite = { version = "0.26.3", features = ["bundled"] }
Expand All @@ -14,7 +15,7 @@ dirs = { version = "4.0.0" }
regex = { version = "1" }
rand = { version = "0.8" }
shellexpand = { version = "2.1", optional = true }
bliss-audio = { version = "0.4", optional = true, path = "../bliss-rs" }
bliss-audio-symphonia = { version = "0.4", optional = true, path = "../bliss-rs" }

[dev-dependencies]
criterion = "0.3"
Expand All @@ -27,4 +28,4 @@ harness = false
default = [ "music_library", "ergonomics", "advanced" ]
music_library = [ "symphonia" ] # song metadata parsing and database auto-population
ergonomics = ["shellexpand"] # niceties like ~ in pathes
advanced = ["bliss-audio"] # advanced language features like bliss playlist generation
advanced = ["bliss-audio-symphonia"] # advanced language features like bliss playlist generation
9 changes: 5 additions & 4 deletions mps-interpreter/benches/file_parse.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use mps_interpreter::{MpsFaye, MpsRunner};
use mps_interpreter::MpsFaye;
//use mps_interpreter::MpsRunner;
use std::fs::File;
use std::io::{BufReader, Read, Seek};

use criterion::{criterion_group, criterion_main, Criterion};

fn interpretor_benchmark(c: &mut Criterion) {
/*fn interpretor_benchmark(c: &mut Criterion) {
let f = File::open("benches/lots_of_empty.mps").unwrap();
let mut reader = BufReader::with_capacity(1024 * 1024 /* 1 MiB */, f);
// read everything into buffer before starting
Expand All @@ -25,7 +26,7 @@ fn interpretor_benchmark(c: &mut Criterion) {
}
})
});
}
}*/

fn faye_benchmark(c: &mut Criterion) {
let f = File::open("benches/lots_of_empty.mps").unwrap();
Expand All @@ -50,5 +51,5 @@ fn faye_benchmark(c: &mut Criterion) {
});
}

criterion_group!(parse_benches, interpretor_benchmark, faye_benchmark);
criterion_group!(parse_benches, /*interpretor_benchmark,*/ faye_benchmark);
criterion_main!(parse_benches);
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ fn regex_flags(tokens: &mut VecDeque<MpsToken>) -> Result<u8, SyntaxError> {

#[inline]
fn build_regex(pattern: &str, flags: u8) -> Result<Regex, regex::Error> {
println!("Compiling");
RegexBuilder::new(pattern)
.case_insensitive((flags & (1 << 0)) != 0)
.multi_line((flags & (1 << 1)) != 0)
Expand Down
18 changes: 9 additions & 9 deletions mps-interpreter/src/lang/vocabulary/sorters/bliss_next_sorter.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use std::collections::VecDeque;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use std::fmt::{Debug, Display, Error, Formatter};

use crate::lang::utility::{assert_name, check_name};
use crate::lang::SyntaxError;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use crate::lang::{MpsIteratorItem, MpsOp, MpsSorter, RuntimeMsg};
use crate::lang::{MpsLanguageDictionary, MpsSortStatementFactory, MpsSorterFactory};
use crate::tokens::MpsToken;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use crate::MpsItem;

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
#[derive(Debug)]
pub struct BlissNextSorter {
up_to: usize,
Expand All @@ -20,7 +20,7 @@ pub struct BlissNextSorter {
item_buf: VecDeque<MpsItem>,
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl std::clone::Clone for BlissNextSorter {
fn clone(&self) -> Self {
Self {
Expand All @@ -32,7 +32,7 @@ impl std::clone::Clone for BlissNextSorter {
}
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl Default for BlissNextSorter {
fn default() -> Self {
Self {
Expand All @@ -44,7 +44,7 @@ impl Default for BlissNextSorter {
}
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl MpsSorter for BlissNextSorter {
fn sort(
&mut self,
Expand Down Expand Up @@ -133,10 +133,10 @@ impl MpsSorter for BlissNextSorter {
}
}

#[cfg(not(feature = "bliss-audio"))]
#[cfg(not(feature = "advanced"))]
pub type BlissNextSorter = crate::lang::vocabulary::sorters::EmptySorter;

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl Display for BlissNextSorter {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "advanced bliss_next")
Expand Down
22 changes: 11 additions & 11 deletions mps-interpreter/src/lang/vocabulary/sorters/bliss_sorter.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
use std::collections::VecDeque;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use std::fmt::{Debug, Display, Error, Formatter};

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use std::collections::HashMap;

use crate::lang::utility::{assert_name, check_name};
use crate::lang::SyntaxError;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use crate::lang::{MpsIteratorItem, MpsOp, MpsSorter, RuntimeMsg};
use crate::lang::{MpsLanguageDictionary, MpsSortStatementFactory, MpsSorterFactory};
use crate::tokens::MpsToken;
#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
use crate::MpsItem;

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
const DEFAULT_ORDER: std::cmp::Ordering = std::cmp::Ordering::Greater;

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
#[derive(Debug)]
pub struct BlissSorter {
up_to: usize,
first_song: Option<MpsItem>,
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl std::clone::Clone for BlissSorter {
fn clone(&self) -> Self {
Self {
Expand All @@ -34,7 +34,7 @@ impl std::clone::Clone for BlissSorter {
}
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl Default for BlissSorter {
fn default() -> Self {
Self {
Expand All @@ -44,7 +44,7 @@ impl Default for BlissSorter {
}
}

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl MpsSorter for BlissSorter {
fn sort(
&mut self,
Expand Down Expand Up @@ -127,10 +127,10 @@ impl MpsSorter for BlissSorter {
}
}

#[cfg(not(feature = "bliss-audio"))]
#[cfg(not(feature = "advanced"))]
pub type BlissSorter = crate::lang::vocabulary::sorters::EmptySorter;

#[cfg(feature = "bliss-audio")]
#[cfg(feature = "advanced")]
impl Display for BlissSorter {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "advanced bliss_first")
Expand Down
1 change: 1 addition & 0 deletions mps-interpreter/src/processing/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ impl FileIter {
#[cfg(not(feature = "music_library"))]
fn populate_item_impl(
&self,
_path: &Path,
path_str: &str,
captures: Option<regex::Captures>,
capture_names: regex::CaptureNames,
Expand Down
Loading

0 comments on commit 327ab6e

Please sign in to comment.