Skip to content

Commit

Permalink
chore(rust): remove wasm-timer dependency (#10347)
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp authored Aug 7, 2023
1 parent 373b2c7 commit 2f9822e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 103 deletions.
3 changes: 0 additions & 3 deletions crates/polars-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ serde_json = "1"
[build-dependencies]
version_check = { workspace = true }

[target.'cfg(target_family = "wasm")'.dependencies]
wasm-timer = "0.2.5"

[features]
simd = ["arrow/simd", "polars-arrow/simd"]
nightly = ["simd", "hashbrown/nightly", "polars-utils/nightly", "polars-arrow/nightly"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{using_string_cache, StringCache, POOL};
pub enum RevMappingBuilder {
/// Hashmap: maps the indexes from the global cache/categorical array to indexes in the local Utf8Array
/// Utf8Array: caches the string values
GlobalFinished(PlHashMap<u32, u32>, Utf8Array<i64>, u128),
GlobalFinished(PlHashMap<u32, u32>, Utf8Array<i64>, u32),
/// Utf8Array: caches the string values
Local(MutableUtf8Array<i64>),
}
Expand Down Expand Up @@ -50,7 +50,7 @@ impl RevMappingBuilder {
pub enum RevMapping {
/// Hashmap: maps the indexes from the global cache/categorical array to indexes in the local Utf8Array
/// Utf8Array: caches the string values
Global(PlHashMap<u32, u32>, Utf8Array<i64>, u128),
Global(PlHashMap<u32, u32>, Utf8Array<i64>, u32),
/// Utf8Array: caches the string values
Local(Utf8Array<i64>),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct State {

#[derive(Default)]
pub(crate) struct RevMapMerger {
id: u128,
id: u32,
original: Arc<RevMapping>,
// only initiate state when
// we encounter a rev-map from a different source,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::hash::{Hash, Hasher};
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use std::time::{SystemTime, UNIX_EPOCH};

use ahash::RandomState;
use hashbrown::hash_map::RawEntryMut;
Expand All @@ -16,6 +15,7 @@ use crate::prelude::InitHashMaps;
/// to determine how many threads use the string cache
/// if the refcount is zero, we may clear the string cache.
pub(crate) static USE_STRING_CACHE: AtomicU32 = AtomicU32::new(0);
static STRING_CACHE_UUID_CTR: AtomicU32 = AtomicU32::new(0);

/// RAII for the string cache
/// If an operation creates categoricals and uses them in a join
Expand Down Expand Up @@ -110,7 +110,7 @@ impl Hash for Key {

pub(crate) struct SCacheInner {
map: PlIdHashMap<Key, ()>,
pub(crate) uuid: u128,
pub(crate) uuid: u32,
payloads: Vec<StrHashGlobal>,
}

Expand Down Expand Up @@ -180,16 +180,7 @@ impl Default for SCacheInner {
fn default() -> Self {
Self {
map: PlIdHashMap::with_capacity(HASHMAP_INIT_SIZE),
#[cfg(not(target_family = "wasm"))]
uuid: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_nanos(),
#[cfg(target_family = "wasm")]
uuid: wasm_timer::SystemTime::now()
.duration_since(wasm_timer::UNIX_EPOCH)
.unwrap()
.as_nanos(),
uuid: STRING_CACHE_UUID_CTR.fetch_add(1, Ordering::AcqRel),
payloads: Vec::with_capacity(HASHMAP_INIT_SIZE),
}
}
Expand Down
89 changes: 4 additions & 85 deletions py-polars/Cargo.lock

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

0 comments on commit 2f9822e

Please sign in to comment.