Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:46:30+00:00 2026-06-05T17:46:30+00:00

In my project many clients will modify a map in server. I use a

  • 0

In my project many clients will modify a map in server. I use a ref of map, like this:

(def dict (ref {})) ; the map we play with

And I update this map using dosync, the STM way. But I found it not as fast as I wish:

user=> (time (dotimes [n 1000000] (dosync ( alter xx assoc xx 1 1))))
"Elapsed time: 2470.766 msecs"

So I decide to use native Java CuncurrentHashMap to take the place of Clojure build-in map and STM. How can I wrap Java CuncurrentHashMap into Clojure so that i can modify it like Clojure map, using assoc, contains?, dissoc and so on. This will make me modify lest line of code.

Is there a way to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:46:33+00:00Added an answer on June 5, 2026 at 5:46 pm

    You can use atom, as you are only modifying a single value you don’t need a transaction and hence no need for ref

    user=> (def dict (atom {}))
    user=> (time (dotimes [n 1000000] (swap! dict assoc :xx 1)))
    "Elapsed time: 108.105703 msecs"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our project constitutes of many modules (e.g. a HR management system containing modules like
In my project I register many ISerializers implementations with the assembly scanner. FWIW this
I am adding MVC to a project that has MANY legacy webform pages. This
I'm working on a web project, which have to process so many client requests.
I'm building WPF client application. I'm following MVC pattern. The project solution has many
I am working a project with many NUnit tests, that were already written long
ok i have a project which has many gridview in its pages... now i
I'm working on a project that has many iframes that are opened and closed
Here is my situation: I have a C project linking with many libraries (I
I have made an application project in Visual Studio 2008 C#, SQL Server from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.